<template>
  <transition name="slide">
    <div class="like">
       <div class="header">
        <div class="back" @click="back()">
          <i class="icon-back"></i>
        </div>
        <div class="title">
          {{ title }}
        </div>
      </div>
      <!-- 列表加载 -->
      <scroll :list="list" class="wrapper" ref="scroll" :probeType="probeType" :listenScroll="listenScroll">
        <recsong-list :RecSongList="list"></recsong-list>
      </scroll>
      <!-- 数据加载时 -->
      <div class="noDate" v-show="list.length == 0 || list == undefined">
        <img src="@/assets/noDate.png">
      </div>
    </div>
  </transition>
</template>

<script>
import Scroll from '@/components/base/Scroll'
import RecsongList from '@/components/recommend/RecsongList'
import { mapState } from 'vuex'
export default {
  components: {
    Scroll,
    RecsongList
  },
  data () {
    return {
      probeType: 1,
      listenScroll: true
    }
  },
  computed: {
    ...mapState(['likeSongList', 'likeAlbum']),
    title () {
      return this.$route.name === 'MineSongList' ? '歌单' : '专辑'
    },
    list () {
      return this.$route.name === 'MineSongList' ? this.likeSongList : this.likeAlbum
    }
  },
  methods: {
    back () {
      this.$router.back()
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../common/stylus/variable'

.slide-enter, .slide-leave-to {
  transform: translateX(100%);
}
.slide-enter-active, .slide-leave-active {
  transition: all 0.5s ease;
}
.like {
  position: fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background-color: $color-background;
  .header {
    background: $color-background;
    .back {
      position:absolute;
      top: 10px;
      left: 10px;
      font-size: 22px;
      color: $color-theme;
    }
    .title {
      width: 60%;
      line-height: 44px;
      font-size: 18px;
      text-align: center;
      margin: 0 auto;
      color: $color-theme;
    }
  }
  .wrapper {
    position: fixed;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 0 0;
  }
  .noDate {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
  }
}
</style>
